<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>
<!DOCTYPE html>
<html>
<head>
	<title>药品资质指标设置</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    
    <style type="text/css">
	    div.outDiv { margin: 15px; }
		table.outTable { width: 100%;  border-collapse: collapse;  border: 1px solid  #3c8dbc;table-layout: fixed; }
		table tr.odd { border: 1px solid  #cacaca;}
		table tr.even { background-color: #f4f7fc; border: 1px solid  #cacaca;}
		table tr.headTr { color: #fff; background-color: #3c8dbc; font-size:14px;font-family:"宋体";height:35px;border: 1px solid ##3c8dbc; z-index:999;}
		table tr.bodyTr { height: 130px; }
		table tr.headTr th { height: 30px; }
		td.checkGroup, td.score { text-align: center;}
		td.score input { width: 60%; height:20px;}
		div.liDiv { min-height: 30px; line-height: 30px; }
		table.inTable { line-height:25px;width: 100%; border-collapse: collapse; table-layout: fixed;font-size:12px;font-family:"宋体"; }
		table.inTable td { vertical-align: top; }
		table.inTable td.score { text-align:center; }
		table.inTable input[type='text'] { width: 60%; }
		
		
	
     
	</style>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    
    <section class="content">
    
                <!-- 。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。 -->
                <div class="outDiv">
				<table class="outTable">
					<tbody>
						<tr class="headTr">
							<th width="120" style="text-align: center;">
								<label>设置</label>
							</th>
							<th style="text-align: center;">药品资质指标设置信息</th>
							<th width="150" style="text-align: center;">评分</th>
						</tr>
						
					<c:forEach items="${drugScoreList}" var="list" varStatus="status">
						<c:if test="${status.count%2==0}">
							
							<input type="hidden" name="projId" value="${projId}" />
							<input type="hidden" name="dicEntProfileId" value="${bidScoreRuleId}" />
							<input type="hidden" name="changStatus" value="${changeStatus}" />
<!-- group1 -->
<tr class="bodyTr odd">
	<td class="checkGroup" >
		<!-- <input type="checkbox"> -->
	</td>
	<td colspan="2">
		<table class="inTable">
			<tbody>
			<c:forEach items="${list.list}" var="childList" varStatus="count">
			<tr>
				<td>
					<label>
						<input type="hidden" id="dicEntprodProfileId${status.count}${count.count}" name="dicEntprodProfileId" value="${childList.dicEntprodProfileId}" />
						<input type="hidden" id="projId" name="projId" value="${projId}" />
						<input type="hidden" id="bidScoreRuleId${status.count}${count.count}" name="bidScoreRuleId" value="${childList.bidScoreRuleId}" />
						<input type="hidden" id="changeStatus${status.count}${count.count}" name="changeStatus" value="" />
						<input class="liCheckbox" type="checkbox"  <c:if test="${childList.checkStatus == 1}">checked="checked"</c:if> id="checkbox${status.count}${count.count}" name="checkbox" onchange="changeCheck('${status.count}${count.count}')">
						${childList.firstLevelIndiName}
					</label>
				</td>
				<td width="150" class="score">
					<input type="text" id="score${status.count}${count.count}" name="score" onchange="changeCheck('${status.count}${count.count}')" value="${childList.score}">
				</td>
			</tr>
			</c:forEach>
		</tbody></table>
	</td>
</tr>


							
						</c:if>
						<c:if test="${status.count%2!=0}">
							
<!-- group1 -->
<tr class="bodyTr odd">
	<td class="checkGroup" style=" background-color:#fff;">
		<!-- <input type="checkbox"> -->
	</td>
	<td colspan="2" style=" background-color:#fff;">
		<table class="inTable">
			<tbody>
			<c:forEach items="${list.list}" var="childList" varStatus="count">
			<tr>
				<td>
					<label>
						<input type="hidden" id="dicEntprodProfileId${status.count}${count.count}" name="dicEntprodProfileId" value="${childList.dicEntprodProfileId}" />
						<input type="hidden" name="projId" value="${projId}" />
						<input type="hidden" id="bidScoreRuleId${status.count}${count.count}" name="bidScoreRuleId" value="${childList.bidScoreRuleId}" />
						<input type="hidden" id="changeStatus${status.count}${count.count}" name="changeStatus" value="" />
						
						<input class="liCheckbox" type="checkbox"  <c:if test="${childList.checkStatus == 1}">checked="checked"</c:if> id="checkbox${status.count}${count.count}" name="checkbox" onchange="changeCheck('${status.count}${count.count}')">
						${childList.firstLevelIndiName}
					</label>
				</td>
				<td width="150" class="score">
					<input type="text" id="score${status.count}${count.count}" name="score" onchange="changeCheck('${status.count}${count.count}')" value="${childList.score}">
				</td>
			</tr>
			</c:forEach>
		</tbody>
	  </table>
	</td>
</tr>
						</c:if>
  					</c:forEach>
                </tbody>
				</table>

			</div>
 </section>
     <div class="text-center" style="margin-top:-10px">
                    <button type="button" class="btn btn-primary btn-sm" onclick="compScoreRule();">保&nbsp;存</button>
                    <a href="toscoreRuleProjList.html" class="btn btn-danger btn-sm">返&nbsp;回</a>
    </div>
    
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">

    function changeCheck(index){
    	$("#changeStatus"+index).val(index);
    }
    
    
  //设置企业资质评分指标
    	function compScoreRule() {
    		
	    	 $.HN.message.confirm("确定保存吗？", '', '').on(function (e) {
	       		 if(e){
	       	  var list=[];
			  var changeStatus = document.getElementsByName("changeStatus");
			  for (var i = 0; i < changeStatus.length; i++){
				  if (changeStatus[i].value !=""){
					 var dicEntprodProfileId = $("input[id^='dicEntprodProfileId"+changeStatus[i].value+"']").val();
					 var bidScoreRuleId = $("input[id^='bidScoreRuleId"+changeStatus[i].value+"']").val();
					 var checkStatus = 0;
 					 var score = $("#score"+changeStatus[i].value).val();
					 
					 if(document.getElementById("checkbox"+changeStatus[i].value).checked){
						 checkStatus = 1;
						 if($("#score"+changeStatus[i].value).val()==""){
							 $.HN.message.alert("评分不能为空！", "消息", "error");
						 }
						}
       			list.push({"dicEntprodProfileId":dicEntprodProfileId,"bidScoreRuleId":bidScoreRuleId,"checkStatus":checkStatus,"score":score,"changeStatus":1});
       			}
			}
            $.post("${ctx}/bidScoreRule/setCompScoreRule.html", {
                "array" : json.jsonToString(list),"projId":"${param.projId}","scoreObject":2,"scorType":1
            }, function(result) {
          	  if (result.success) {
                  $.HN.message.alert("操作成功！", "消息", "success");
                  document.location.href="${ctx}/bidScoreRule/toscoreRuleProjList.html"; 
              } else {
                  $.HN.message.alert("操作失败", "消息", "error");
              }
            }, "json")
			  
			  	}
			  });
			 }
    	
    </script>
</body>
</html>